import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
/*********************************************************************
 * Copyright (C) 2008 by Duncan A. Buell.  All rights reserved.
 * Driver for Ex 08 on permutations and the Jumble puzzle
 *
 * @author Duncan A. Buell
 * @version 1.00 2008-12-22
**/
public class Driver
{
/*********************************************************************
 * main method.
 * @throws FileNotFoundException 
**/
  public static void main (String[] args) throws FileNotFoundException
  {
    final String classLabel = "Driver: ";
    Scanner inFile = null;
    ArrayList<String> perm = null;
    SpellChecker jumble = null;
    

    
    inFile = FileUtils.ScannerOpen("zin1");
    FileUtils.setLogFile("zlogfile1");

    FileUtils.logFile.printf("%s beginning%n", classLabel);
    
   
    jumble = new SpellChecker();
    
    jumble.readDictionary("dictionary.txt"); 		//reads from the provided dictionary
    perm = new ArrayList<String>();
    jumble = jumble.readCharacters(inFile);
    jumble.generatePermutations(perm, jumble.getLetters());
    

    //prints the number of Permutations to the file(only counts ones that start with a letter)
    FileUtils.logFile.printf("%s The Number Of Permuatations that start with a letter is "+jumble.getNumberOfPerms()+"%n", classLabel);
    FileUtils.logFile.printf("%s ending%n", classLabel);
    FileUtils.logFile.flush();

  } // public static void main (String[] args)
} // public class JumbleDriver
